package Decoration;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class PriceByDecorationDriver{
    public static void main(String[] args) throws Exception {

        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf, "Price By Decoration");

        job.setJarByClass(PriceByDecorationDriver.class);

        job.setMapperClass(PriceByDecorationMapper.class);
        job.setReducerClass(PriceByDecorationReducer.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(DoubleWritable.class);

        FileInputFormat.addInputPath(job, new Path("input/second-hand_housing.csv"));
        FileOutputFormat.setOutputPath(job, new Path("output/Decoration"));

        System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
}